package com.ase.mobile.service.impl;

import com.ase.mobile.entity.User;
import com.ase.mobile.service.UserService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author gyhstart
 * @create 2021/5/25 - 2:03
 **/
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 添加用户
     *
     * @param
     * @return
     */
    @Override
    public String saveUser() {
        new Thread(()->{
            rabbitTemplate.convertAndSend("queue_user", new User("Curry","30","1",33));
        }).start();

        new Thread(()->{
            rabbitTemplate.convertAndSend("queue_user", new User("James","23","1",38));
        }).start();

        new Thread(()->{
            rabbitTemplate.convertAndSend("queue_user", new User("Kobe","24","1",42));
        }).start();

        new Thread(()->{
            rabbitTemplate.convertAndSend("queue_user", new User("Harden","13","1",31));
        }).start();

        new Thread(()->{
            rabbitTemplate.convertAndSend("queue_user", new User("PaulGeorge","13","1",30));
        }).start();

        return null;
    }
}
